<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div></div>
    <script>
        show();
        setInterval(show, 1000)

        function show() {
            var div = document.querySelector('div');
            var time = '2021/10/22 16:50:00'
            var nowTime = +new Date();
            var endTime = +new Date(time);
            var gapTime = (endTime - nowTime) / 1000
            var d = Math.floor(gapTime / 60 / 60 / 24);
            var h = Math.floor(gapTime / 60 / 60 % 24);
            var m = Math.floor(gapTime / 60 % 60);
            var s = Math.floor(gapTime % 60)
            var sum = handlenum(d) + ":" + handlenum(h) + ":" + handlenum(m) + ":" + handlenum(s)
            div.innerHTML = sum;
        }

        function handlenum(num) {
            num = num < 10 ? '0' + num : num;
            return num;
        }
    </script>
</body>

</html>